package vns.server.domain;


import java.util.Set;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import vns.shared.ObjectPropertyTypeDTO;

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")

public class ObjectPropertyType {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key id;
	
	@Persistent 
	private String name;
	@Persistent
	private String basetype;
	@Persistent
	private String objecttype;
	
	
	@Persistent 
	private String describe;
	
	public ObjectPropertyType(ObjectPropertyTypeDTO objectPropertyTypeDTO){
		this.basetype	=	objectPropertyTypeDTO.getBaseType();
		this.name		=	objectPropertyTypeDTO.getName();
		this.describe	=	objectPropertyTypeDTO.getDescribe();
		this.objecttype 		= 	objectPropertyTypeDTO.getOtype();
	}
	
	public void updateFromDTO(ObjectPropertyTypeDTO objectPropertyTypeDTO){
		this.basetype	=	objectPropertyTypeDTO.getBaseType();
		this.name		=	objectPropertyTypeDTO.getName();
		this.describe	=	objectPropertyTypeDTO.getDescribe();
		this.objecttype 		= 	objectPropertyTypeDTO.getOtype();
	}
	
	public ObjectPropertyTypeDTO toDTO() {
		ObjectPropertyTypeDTO objectPropertyTypeDTO = 
			new ObjectPropertyTypeDTO(
				this.id, 
				this.basetype,
				this.objecttype,
				this.name, 
				this.describe);
		return objectPropertyTypeDTO;
	}
	
	public Key getId(){
		return id;
	}
			
	
	public String getObjecttype() {
		return objecttype;
	}

	public void setObjecttype(String objecttype) {
		this.objecttype = objecttype;
	}

	public String getBaseType(){
		return basetype;
	}
	
	public void setBaseType(String baseType){
		this.basetype=baseType;
	}
	
	public String getName(){
		return name;
	}
	
	public void setName(String Name){
		this.name=Name;
	}

	public String getDescribe(){
		return describe;
	}
	
	public void setDescribe(String _describe){
		this.describe=_describe;
	}
}
